package com.sbm;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import com.sbm.app.listener.AppContextPreparedListener;
import com.sbm.app.listener.AppEnvPreparedListener;
import com.sbm.app.listener.AppFailedListener;
import com.sbm.app.listener.AppReadyListener;
import com.sbm.app.listener.AppStartedListener;
import com.sbm.app.listener.AppStartingListener;

/**
 * 启动异步调用 启动WebMvc SpringBoot应用配置
 *
 * @author Administrator
 */
@EnableAsync
@EnableWebMvc
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, JacksonAutoConfiguration.class })
public class Application {
	public static void main(String[] args) {
		// 创建
		SpringApplication app = new SpringApplication(Application.class);
		// 事件监听(按启动顺序)
		app.addListeners(new AppStartingListener());
		app.addListeners(new AppStartedListener());
		app.addListeners(new AppEnvPreparedListener());
		app.addListeners(new AppContextPreparedListener());
		app.addListeners(new AppReadyListener());
		app.addListeners(new AppFailedListener());
		// 运行
		app.run(args);
	}
}
